#include "pch.h"

#include "threading/win32/win32interlocked.h"



namespace Win32
{

	///
	int Win32Interlocked::Increment(volatile int &var)
	{
		return InterlockedIncrement((volatile LONG*)&var);
	}


	///
	int Win32Interlocked::Decrement(volatile int &var)
	{
		return InterlockedDecrement((volatile LONG*)&var);
	}


	///
	int Win32Interlocked::Add(volatile int &var, int add)
	{
		return InterlockedExchangeAdd((volatile LONG*)&var, add);
	}


	///
	int Win32Interlocked::Exchange(int volatile * dst, int val)
	{
		return InterlockedExchange((volatile LONG*)dst, val);
	}


	///
	int Win32Interlocked::CompareExchange(int volatile * dst, int exchange, int comparand)
	{
		return InterlockedCompareExchange((volatile LONG*)dst, exchange, comparand);
	}

}